package com.reverse.engineering.util.core.run;

import com.ApplicationProperties;
import com.reverse.engineering.util.core.run.enums.ReadType;
import com.reverse.engineering.util.core.run.util.ApplicationUtils;
import com.reverse.engineering.util.core.run.util.DatabaseUtils;
import com.reverse.engineering.util.core.run.util.InitProperties;
import com.reverse.engineering.util.core.run.util.InitStaticField;
import com.reverse.engineering.util.core.run.util.ReadExcel;
import com.reverse.engineering.util.core.run.util.ReadTemplate;

public class Run {

    public static void main(String[] args) throws Exception {
        run();
    }

    public static void run() throws Exception {
        // 初始化程序数据
        InitStaticField.init();

        if (ApplicationProperties.read == ReadType.EXCEL) {
            // 从Excel读取数据
            ReadExcel.readExcel();
        } else if (ApplicationProperties.read == ReadType.DATABASE) {
            // 从数据库读取数据
            DatabaseUtils.readDatabase();
        }

        // 读取模板文件并给模板配置对应的占位符
        ReadTemplate.readTemplate();

        // 初始化属性
        InitProperties.initProperties();

        // 创建文件
        ApplicationUtils.createFile();
    }

}